package com.example.lib_repair.detail

import com.example.lib_common.mvi.BaseRepository
import com.example.lib_common.mvi.ResponseEntity
import com.example.lib_repair.ApiService
import com.example.network_sdk.HttpType
import com.example.network_sdk.NetWorkFactory
import kotlinx.coroutines.flow.Flow
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File

class DetailRepository : BaseRepository() {
    fun requestDetailRepair(map:HashMap<String,Any>) : Flow<ResponseEntity<DetailEntity>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestDetailRepair(createBody(map))
    }

    fun requestAddRepair(map:HashMap<String,Any>) : Flow<ResponseEntity<AddEntity>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestAddRepair(createBody(map))
    }

    fun requestCompleteRepair(map:HashMap<String,Any>) : Flow<ResponseEntity<AddEntity>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestCompleteRepair(createBody(map))
    }


    fun requestAddRepairImg(map:HashMap<String,Any>) : Flow<ResponseEntity<ImgEntity>> {
        return NetWorkFactory.factory(HttpType.TOKEN)!!
            .create(ApiService::class.java)
            .requestAddRepairImg(createBody(map))
    }

}